package osami.communication;

//import osami.Settings;


/**
 * A class which identifies an OSAMI node
 * 
 * @author osami
 *
 */
public class OsamiIdentifier
{
	private int iID;
	
	/**
	 * Constructor of the OSAMI identifier. The identifier
	 * value is read from the Settings singleton object.
	 * 
	 */
	public OsamiIdentifier()
	{
		iID = Integer.parseInt( Settings.getInstance().getValue( Settings.OSAMI_NODE_ID ) );
	}
	
	/**
	 * Constructor of the OSAMI identifier.
	 * 
	 * @param aID
	 */
	public OsamiIdentifier( int aID )
	{
		iID = aID;
	}

	/**
	 * Returns the ID-number.
	 * 
	 * @return int
	 */
	public int getID()
	{
		return iID;
	}
	
	/**
	 * Returns the ID -number as a String.
	 * 
	 * @return String
	 */
	public String toString()
	{
		return Integer.toString( iID );
	}
	
	/**
	 * Compares given ID to own ID.
	 * 
	 * @param aIdentifier
	 * @return boolean
	 */
	public boolean equals( OsamiIdentifier aIdentifier )
	{
		return ( getID() == aIdentifier.getID() );
	}
}
